﻿using System.IO;
using System.Threading.Tasks;
using Dpx.Services;
using Moq;

namespace Dpx.UnitTest.Helpers {
    public static class PoetryStorageHelper {
        /// <summary>
        /// 删除数据库文件
        /// </summary>
        public static void RemoveDatabaseFile() {
            File.Delete(PoetryStorage.PoetryDbPath);
        }

        /// <summary>
        /// 获得已初始化的诗词存储。
        /// </summary>
        public static async Task<PoetryStorage> GetInitializedPoetryStorage() {
            var _poetryStorage = new PoetryStorage(new Mock<IPreferenceStorage>().Object);
            await _poetryStorage.InitializeAsync();
            return _poetryStorage;
        }
    }
}